﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Acms.Bll;

namespace Ait.Web.Templates.NewsHolder
{
    public partial class _default : Acms.AcmsControls.TemplatePage
    {
        //protected override void AttachEvents()
        //{
        //    ucFeedNews.SelectData += new EventHandler<Acms.DataControls.SelectEventArgs<Post>>(ucFeedNews_SelectData);
        //}

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            dsChildren.SelectData += new EventHandler<Acms.DataControls.SelectEventArgs<Acms.Bll.Post>>(dsChildren_SelectData);
        }


        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                DataBind();
            }

        }

        void dsChildren_SelectData(object sender, Acms.DataControls.SelectEventArgs<Acms.Bll.Post> e)
        {
            e.SetData(Post.GetAllBySiteIdAndParentPath(AcmsContext.SiteId, AcmsContext.CurrentPost.Path, AcmsContext.SiteVersion));
        }

        //void ucFeedNews_SelectData(object sender, Acms.DataControls.SelectEventArgs<Post> e)
        //{
        //    if (AcmsContext.CurrentPost != null)
        //    {
        //        e.SetData(GetArticles(Post.GetAllBySiteIdAndParentPath(AcmsContext.SiteId, "~/News", AcmsContext.SiteVersion)));
        //    }
        //    else
        //    {
        //        e.SetData(DummyPost.CreateDummyList(12));
        //    }
        //}

    }
}
